A catch
clause that only rethrows the caught exception has the same effect as omitting the catch
altogether and letting
it bubble up automatically.
$s = "";
try {
$s = readMyFile($fileName);
} catch (Exception $e) {
throw $e; // Noncompliant
}
Such clauses should either be removed or populated with the appropriate logic.
$s = readMyFile($fileName);
or
$s = "";
try {
$s = readMyFile($fileName);
} catch (Exception $e) {
error_log($e->getMessage());
throw new MyException("an exception occurred", 2, $e);
}